CallCustomiseAPI
≥4.8.5.200415.0
Support anonymous user to call this API.
Interface Function
Call Customise API
Introduction
- Content-Type is
multipart/form-data;
, which value is specified by form.- This API only allows requests to be initiated from within DM.
- You need to specify the ID of Customise API in the URL when calling, for example:
/internalapi/CallCustomiseAPI?id=60b5f4c3f9ea92283c56a5f2
,60b5f4c3f9ea92283c56a5f2
is ID for Customised Security API。Please refer to below example
Request Parameter
Parameter | Type | Comment |
---|---|---|
file | String | Content of file control |
data | String | Other document info apart from attachment |
parameter | String | Other info for App API. For serialized value of json, please refer to CallCustomiseAPI |
Instroduction of data
Field | Type | Comment |
---|---|---|
FormAlias | String | Form alias, the identity of the form |
DataId | String | Document ID: GUID without underline, which can be null and is generated automatically by API when ID is null. |
UserName | String | |
UserId | String | |
AttachmentFiledName | String | The control Field name corresponding to the attachment in the Form |
TransferToPDF | Bool | Whether or not to convert attachment to PDF, true by default. 4.5.1 starts to support. If the attachment control is a secure upload control, this field is ignored. |
ActionCode | String | |
ActionMessage | String | |
Data | Dictionary<string, object> |
For details, please refer to below table |
DocumentData | Dictionary<string, string> |
Dictionary of other fields of documents |
Introduction of data
Field | Type | Comment |
---|---|---|
fileName | string | File name |
fileUUID | string | File ID, which value can by specified by GUID; if not specified, it's generated automatically by API. Using field DownloadAttachment to download attachment. |
[info] Note
For procedures of registering Customise API, please refer to (RegistrationCustomiseAPI.md)
Request Sample
<!--Atrribute of form enctype should be multipart/form-data-->
<form enctype= "multipart/form-data" ID="form1">
<input type="file" id="file" name="file">
<input type="button" value="Submit" onclick="uploadFile()">
</form>
function uploadFile(){
var ofile = $("#file").get(0).files[0];
var formData = new FormData();
if(!ofile){
alert('Please upload file!','info');
return;
}
var data=JSON.stringify({
"FormAlias": "DemoFormAlias",
"DataId": "",
"UserName": "DemoUser",
"UserId": "DemoUser",
"ActionCode": "",
"ActionMessage": "",
"AttachmentFiledName": "File",
"TransferToPDF":true,
"Data": {
"fileName": "",
"fileUUID": ""
},
"DocumentData": {
"OtherField": "demo"
}
});
var parameter=JSON.stringify({
"TestA": "a",
"TestB": "123"
});
formData.append("file", ofile);
formData.append("data", data);
formData.append("parameter", parameter);
$.ajax({
url: '../pages/pagecode/internalapi/CallCustomiseAPI?id=5e6b43aaf9ea922b58c9671f',
type: "POST",
data: formData,
cache: false,
processData: false,//When submit it will not serialize data, set true by default
contentType: false,
success: function(data){
console.log(data);
}
});
}
Return Type
- StatusCode:Response status of CallCustomiseAPI. 200 200 indicates the successful calling.
- Info:Infomation of CallCustomiseAPI,developers can check error reason when error occurs.
- Data:Content returned by interface.
Return Sample
{
"StatusCode": 200,
"Info": "Request (or process) succeeded",
"Data": "something the custom code in the App API returns"
}